package com.surelution.projects.crm
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.grails.plugins.excelimport.ExcelImportUtils;

import sun.java2d.pipe.BufferedRenderPipe;

class GasCardController {

	static Map CONFIG_BOOK_COLUMN_MAP = [
		sheet:"test",
		startRow: 3,
		columnMap:  [
			'B':'stationName',
			'C':'Money',
			'D':'tradeType',
			'E':'MarketID',
			'F':'MarketName',
			'H':'TradeTime',
			]
		]
	
	
    def index = { }
	
	def gasCardList = {
		int fromLine = 0
		
		def file = params.excelFile

		int lineNum = 0
		BufferedReader reader = new BufferedReader(new InputStreamReader(file.inputStream, "gbk"))
		reader.eachLine {line->
			if(lineNum > fromLine) {
				String[] words = line.split()
				println words
				
				if(words.length > fromLine) {
					println "111:${words}"
				}
			}
			lineNum++
		}
		redirect(action:"index")
	}
	def printStation = {
		GasStation.list().each{
			println "update gas_station set short_name ='${it.shortName}' where id=${it.id};"
		}
	}
}
